<template>
    <header class="header">
        <h1>todos</h1>
        <input autofocus="autofocus" autocomplete="off" placeholder="您的待办事项是?" class="new-todo" @keyup.enter="addTitle" />
    </header>
</template>

<script setup>
import {defineEmits} from 'vue'
const emits = defineEmits(['add'])

    function addTitle(event) {
       emits('add', event.target.value);
        //清空操作
        event.target.value = '';
    }

</script>